<template>
  <div id="addresslist">
    <c-title :hide="false"
             text="收货地址管理"></c-title>
    <!--<c-addressList :datasource="list"></c-addressList>-->
    <div class="box">
      <div class="content01"
           v-for="(item, itemIndex) in datasource"
           :key='itemIndex'
          >
        <div class="content01-box">
          <div>
            <ul class="xinxi">
              <li class="name">{{ item.username }}</li>
              <li class="phone">{{ item.mobile }}</li>
              <li class="default" v-if="checkList[itemIndex]">默认</li>
            </ul>
            <div class="where">
              {{ item.province }} {{ item.city }} {{ item.district }}
              {{ item.street }} {{ item.address }}
            </div>
          </div>
          <div class="bianji"
              @click.stop="alterHandler(itemIndex)">
              <i class="iconfont icon-fontclass-xiugai"></i>
          </div>

        </div>
        <div class="xuxian"></div>
        <div class="choice">
          <div class="add01" @click.stop="selectBolfun">
            <van-checkbox checked-color="#f15353"
                          v-model="checkList[itemIndex]"
                          @click="setDefaultAddress(itemIndex)">
              <div class="moren">默认地址</div>
            </van-checkbox>
          </div>
          <div class="content01-right">
            <div class="fuzhi"
               v-clipboard:copy="copyLink(item)"
               v-clipboard:success="onCopy"
               v-clipboard:error="onError"
            >
              <i class="iconfont icon-fuzhi"></i>
              <div class="copy">复制</div>
            </div>
            <div class="shanchu"  @click.stop="deleteHandler(item, itemIndex)">
              <i class="iconfont icon-appointment_delete"></i>
              <div class="del">删除</div>
            </div>

          </div>
        </div>
      </div>

      <div style="height: 2.8125rem;"></div>

      <div class="content03" v-if="show_add_address"
           @click="addendAddress"
           :style="{width:(this.fun.getPhoneEnv() == 3?'375px':'100%')}">
        <div class="new-add">
          <i class="iconfont icon-icon_add"></i>
          <div class="dizhi">新增收货地址</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import address_controller from "./addresslist_controller";

export default address_controller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
  #addresslist {
    .content01-right{
      display: flex;
      align-items: center;
    }
    .content01-box{
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .icon-fontclass-xiugai{
      font-weight: bold;
      color:#909090;
    }
    .fuzhi,.shanchu{
      display: flex;
      align-items: center;
    }
    .shanchu{
      margin-left: 1.5625rem;
    }
    .icon-fuzhi,.icon-appointment_delete{
      font-weight: bold;
      font-size: 0.9375rem;
      color: #909090;
    }
    .copy,.del{
      color:#909090;
      margin-left: .1563rem;
      font-size: 0.8125rem;
    }
    .box {
      background-color: #f5f5f5;
      margin-bottom: 4rem;
    }

    ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }


    .content01 {
      margin: .625rem .75rem;
      padding: .9063rem .75rem .875rem;
      background-color: #fff;
      border-radius: .5rem;
    }

    .xinxi {
      font-size: .9375rem;
      color: #00001C;
      text-align: left;
      display: flex;
      line-height: 1;
      align-items: center;
    }

    .name {
      margin-right: 0.625rem;
    }

    .phone {
      margin-right: 0.375rem;
    }

    .default{
      padding: .25rem;
      color: #F15353;
      background-color: #FDE5E5;
      border-radius: 0.1875rem;
      font-size: 0.6875rem;
    }

    .where {
      text-align: left;
      margin-left: 0;
      margin-right: 0.625rem;
      font-weight: 500;
      font-size: 0.9375rem;
      color: #00001C;
      margin-top: 0.5938rem;
      font-weight: bold;
    }

    .xuxian {
      height: 0.0625rem;
      background-color: #ebebeb;
      margin-top: 0.625rem;
    }

    .choice {
      margin-top: .875rem;
      width: 100%;
      display: flex;
      justify-content: space-between;
    }

    .add01 {
      display: flex;
      align-items: center;
    }

    .moren {
      font-size: 0.8125rem;
      color: #909090;
      z-index: 96;
    }

    .bianji {
      float: left;
      margin-left: 1.25rem;
    }

    .content03 {
      width: 100%;
      padding: .625rem .75rem;
      background-color: #fff;
      position: fixed;
      display: flex;
      justify-content: center;
      bottom: 0;
      z-index: 99;
    }

    .new-add {
      width: 100%;
      display: flex;
      justify-content: center;
      height: 2.5rem;
      line-height: 2.5rem;
      background: #F15353;
      text-align: center;
      border-radius: 1.2813rem;
    }
    .icon-icon_add{
      color:#fff;
      font-size: .625rem;
      font-weight: bold;
    }


    .new-add .dizhi {
      margin-left:.3125rem;
      display: inline-block;
      font-size: .9375rem;
      color: white;
      text-align: center;
    }
  }
</style>
